<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-page-header :content="$route.meta.title" @back="$router.back()" />
        </el-card>
        <el-card class="mt-4 !border-none" shadow="never">
            <div class="mt-4">
                <el-table :data="pager.lists">
                    <el-table-column label="操作人" prop="admin_name" show-overflow-tooltip align="center"/>
                    <el-table-column label="操作数量" prop="stock" show-overflow-tooltip align="center"/>
                    <el-table-column label="操作类型" prop="type" show-overflow-tooltip align="center" >
                        <template #default="{ row }">
                            <span v-if="row.type == 1">入库</span>
                            <span v-if="row.type == 2">出库</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作时间" prop="create_time" show-overflow-tooltip align="center"/>
                    <el-table-column label="备注" prop="remark" min-width="120" align="center"/>
                </el-table>
            </div>
            <div class="flex justify-end mt-4">
                <pagination v-model="pager" @change="getLists" ref="paginationRef" />
            </div>
        </el-card>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { goods_userLog } from '@/api/repertory'
import { usePaging } from '@/hooks/usePaging'
import { useRoute } from 'vue-router'
const route = useRoute()
const queryParams = reactive<any>({
    goods_user_id: route.query.id
})
// 分页
const { pager, getLists, resetPage, resetParams } = usePaging({
	fetchFun: goods_userLog,
	params: queryParams,
})

onMounted(() => {
    getLists()
})
</script>

<style scoped></style>